package com.kfm.pm;


import java.util.Arrays;

public class Demo05 {

    public static void main(String[] args) {
        // Arrays 类的应用
        int[] arr = new int[]{12, 23, 34, 21, 22, 10};
//        int[] arr1 = new int[]{12, 23, 34, 21, 22, 10};
////        Arrays.sort(arr);
////        for (int i : arr) {
////            System.out.println(i);
////        }
//        System.out.println(arr == arr1);
//        System.out.println(Arrays.equals(arr, arr1));
//
//        int[] newArr = new int[5];
//        Arrays.fill(newArr, 5);
////        System.out.println(Arrays.toString(newArr)); // [5, 5 , 5, 5, 5]
//        System.out.print("[");
//        for (int i = 0; i < arr.length; i ++) {
//            System.out.print(i == arr.length - 1 ? arr[i] : arr[i] + ", ");
//        }
//        System.out.print("]");
//        int[] nArr = Arrays.copyOf(arr, 8);
//        System.out.println(Arrays.toString(nArr));

        int[] newArr2 = new int[5];
        // arrcopy(Object src, int srcPos, Object dest, int destPos, int length)
        System.arraycopy(arr, 1, newArr2, 1, 4);
        System.out.println(Arrays.toString(newArr2));
    }
}
